package com.qianya.oa.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qianya.oa.domain.SysHospital;
import com.qianya.oa.mapper.HospItalInfoMapper;
import com.qianya.oa.service.HospitalInfoService;
import com.qianya.oa.util.CommonResult;
import com.qianya.oa.vo.SysHospitalVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class HospitalInfoServiceImpl implements HospitalInfoService {

    @Resource
    HospItalInfoMapper hospItalInfoMapper;
    @Override
    public CommonResult<?> selectAllHospitalServices(Integer pageNum, Integer pageSize,SysHospital sysHospital) {
        PageHelper.startPage(pageNum,pageSize);
        List<SysHospital> sysHospitals = hospItalInfoMapper.selectAllHospitalServices(sysHospital.getHospitalName(),sysHospital.getHospitalLv());
        PageInfo<SysHospital> pageInfo = new PageInfo<>(sysHospitals);
        return CommonResult.success(pageInfo);
    }

    @Override
    public CommonResult<?> addHospital(SysHospital sysHospital) {
        sysHospital.setCreateTime(new Date());
        return CommonResult.success(hospItalInfoMapper.addHospital(sysHospital));
    }

    @Override
    public CommonResult<?> deleteHospitalById(Integer id) {
            return CommonResult.success(hospItalInfoMapper.deleteHospitalById(id));
    }

    @Override
    public CommonResult<?> updateHospital(SysHospital sysHospital) {
            return CommonResult.success(hospItalInfoMapper.updateHospital(sysHospital));
    }

    @Override
    public   List<SysHospitalVo> selectConfrimHospital() {
        return hospItalInfoMapper.selectConfrimHospital();
    }

    @Override
    public   List<SysHospitalVo> selectUnConfrimHospital() {
        return hospItalInfoMapper.selectUnConfrimHospital();
    }


}
